//
//  AXMyWdfxMyFxTableViewCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/22.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXMyWdfxMyFxTableViewCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"
#import "UITableView+SDAutoTableViewCellHeight.h"

@implementation AXMyWdfxMyFxTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        [self setlayout];
    }
    return self;
}


- (void)creatView {
    
    /** 用户图像 */
    self.userImageView = [[UIImageView alloc]init];
    self.userImageView.cornerRadius = 30;
    self.userImageView.image = [UIImage imageNamed:@"xy.jpeg"];
    [self.contentView addSubview:self.userImageView];
    /** 店铺名字 */
    self.shopNameLabel = [[UILabel alloc]init];
    self.shopNameLabel.text = @"小猪佩奇店铺";
    self.shopNameLabel.font = FONT_FOURTEEN;;
    [self.contentView addSubview:self.shopNameLabel];
    
    self.starAppraiseView = [[ ZXSampleStarAppraiseView alloc]init];
    self.starAppraiseView.score = 5;
    [self.contentView addSubview:self.starAppraiseView];
    
    /** 继续分享 */
    self.jxButton = [[UIButton alloc]init];
    self.jxButton.titleLabel.font = FONT_FOURTEEN;;
    [self.jxButton setTitleColor:COLOR_GREEN forState:UIControlStateNormal];
    [self.jxButton setTitle:@"去分享" forState:UIControlStateNormal];
    [self.contentView addSubview:self.jxButton];
    
    /** 分享时间 */
    self.fxTimeLabel = [[UILabel alloc]init];
    self.fxTimeLabel.textColor = COLOR_GREEN;
    self.fxTimeLabel.text = @"分享于2018.10.10";
    self.fxTimeLabel.font = FONT_FOURTEEN;;
    [self.contentView addSubview:self.fxTimeLabel];
    
    
}


- (void)setlayout {
    
    self.userImageView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(60)
    .heightIs(60);
    
    self.shopNameLabel.sd_layout
    .leftSpaceToView(self.userImageView, 10)
    .topSpaceToView(self.contentView, 5)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(30);
    
    self.starAppraiseView.sd_layout
    .leftSpaceToView(self.userImageView, 10)
    .topSpaceToView(self.shopNameLabel, 0)
    .widthIs(100)
    .heightIs(30);
    
    self.jxButton.sd_layout
    .topEqualToView(self.shopNameLabel)
    .rightSpaceToView(self.contentView, 10)
    .widthIs(60)
    .heightIs(30);
    
    self.fxTimeLabel.sd_layout
    .topEqualToView(self.starAppraiseView)
    .rightSpaceToView(self.contentView, 10)
    .widthIs(120)
    .heightIs(30);
    
    
    [self setupAutoHeightWithBottomView:self.starAppraiseView bottomMargin:10];
}

@end
